package Web;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import Main.main;



@Path("/listen")
public class listen {
    @POST
    @Consumes("application/x-www-form-urlencoded")
    @Produces("text/html")
    public String commit(){
    	String ret=	"<html>\n"+
    				"<head>\n"+
    				"</head>\n"+
    				"<body>\n"+
    				"<center>\n";
    	if(main.menu.on){
    		main.menu.on=false;
    		main.menu.listenningOff();
    		main.menu.log.update("Listening Turned Off");
    		ret+="<h1>Turned off!</h1>";
    	}
    	else{
    		main.menu.on=true;
    		main.menu.listenningOn();
    		main.menu.log.update("Listening Turned On");
    		ret+="<h1>Turned on!</h1>";
    	}
    	ret+=	"Return to <a href=\"/\">index</a>\n"+
    			"</center>\n</body>\n</html>";
    	return ret;
    }
}
